package com.situ.shop.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.shop.model.DTO.SecKillProductWithProductInfo;
import com.situ.shop.model.SecKillProduct;
import com.situ.shop.model.SecKillStatus;
import com.situ.shop.model.search.SecKillProductSearchBean;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public interface SecKillProductService {
    // 根据id查询
    SecKillProduct findById(Integer id);
    // 分页查询
    Page<SecKillProduct> findAll(Page<SecKillProduct> page, SecKillProductSearchBean searchBean);


// 增删改
    boolean save(SecKillProduct seckillProduct);

    boolean update(SecKillProduct seckillProduct);

    int deleteByIds(List<Integer> ids);

    //根据id查该秒杀商品的具体信息
    public SecKillProductWithProductInfo selectByIdWithProductInfo(Integer id);
    //查询所有秒杀商品的具体信息
    public List<SecKillProductWithProductInfo> selectAllWithProductInfo();
    //根据条件查询该商品的具体信息
    public List<SecKillProductWithProductInfo> selectWithProductInfoByCondition(SecKillProductSearchBean condition);


    //秒杀核心方法
    boolean processSecKill(Integer userId, Integer secKillProductId, Integer quantity);

    //检查秒杀活动状态
    SecKillStatus checkSecKillStatus(Integer secKillProductId);

    //检查用户是否已经买过该秒杀商品
    boolean checkUserPurchased(Integer userId, Integer secKillProductId);

    //获取秒杀商品实时库存
    Integer getAvailableStock(Integer secKillProductId);

    //商品下架
    boolean offShelves(Long id);


}
